﻿
<c:if test="${obj.totalCount>0}">

<c:set var="cp" value="${obj.pageNumber}" />
<c:set var="mp" value="${obj.totalPages}" />

<div class='pagination'>符合条件共<b>${obj.totalCount}</b>条记录
 <c:if	test="${cp==1}">
	<span class='curpage'>首页</span>
</c:if> <c:if test="${cp!=1}">
	<a href="#" onclick="toPage(1)">首页</a>
</c:if> 
<c:set var="beginPage" value="${cp-5}" />
<c:if test="${beginPage<1}">
	<c:set var="beginPage" value="1" />
</c:if>
<c:set var="endPage" value="${cp+5}" />
<c:if test="${endPage>mp}">
	<c:set var="endPage" value="${mp}" />
</c:if>
<c:if test="${cp==1}">
上一页
</c:if>
<c:if test="${cp!=1}">
<a href="#" onclick="toPage('${cp-1}')">上一页</a>
</c:if>

<c:forEach begin="${beginPage}" end="${endPage}" var="pp">
	<c:if test="${cp==pp}">
		<span class='curpage'>${pp}</span>
	</c:if>
	<c:if test="${cp!=pp}">
		<a href="#" onclick="toPage('${pp}')">${pp}</a>
	</c:if>
</c:forEach> 
<c:if test="${cp==mp}">
下一页
</c:if>
<c:if test="${cp!=mp}">
<a href="#" onclick="toPage('${cp+1}')">下一页</a>
</c:if>
<c:if test="${cp==mp}">
	<span class='curpage'>尾页</span>
</c:if> <c:if test="${cp!=mp}">
	<a href="#" onclick="toPage('${mp}')">尾页</a>
</c:if></div>
</c:if>


<script type="text/javascript">
function toPage(page){
	document.forms[0].p.value=page;
	document.forms[0].submit();
}
</script>